<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Unix)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGED" CONTENT="20101230;16062700">
	<STYLE TYPE="text/css">
	<!--
		@page { margin: 0.79in }
		P { margin-bottom: 0.08in }
		PRE { font-family: "Times New Roman" }
	-->
	</STYLE>
</HEAD>
<BODY LANG="el-GR" DIR="LTR">
<PRE LANG="en-US"><FONT SIZE=5><B>solund</B></FONT>


<FONT SIZE=4><SPAN LANG="en-US">Solves an underdetermined system of linear equations, with SVD, </SPAN></FONT>
<FONT SIZE=4><SPAN LANG="en-US">for details see book of Hang T. Lau, “A Java Numerical Library for Scientists and engineers|”, Chapman &amp; Hall, 2004</SPAN></FONT>

<FONT SIZE=4><SPAN LANG="en-US"><B>Example: Can be run with F5 within the ScalaLab Editor (Ctrl-E to open the editor)</B></SPAN></FONT>


<SPAN LANG="en-US">import java.text.DecimalFormat;</SPAN>
<SPAN LANG="en-US">import numal.*;</SPAN>

<SPAN LANG="en-US">public class Test_solund extends Object {</SPAN>
<SPAN LANG="en-US">	</SPAN>
<SPAN LANG="en-US">	public static void main(String args[]) {</SPAN>

    <SPAN LANG="en-US">int i;</SPAN>
    <SPAN LANG="en-US">double b[] = new double[9];</SPAN>
    <SPAN LANG="en-US">double em[] = new double[8];</SPAN>
    <SPAN LANG="en-US">double a[][] = new double[9][6];</SPAN>

    <SPAN LANG="en-US">a[1][1]=22; a[1][2]=a[2][3]=10.0; a[1][3]=a[7][1]=a[8][5]=2.0;</SPAN>
    <SPAN LANG="en-US">a[1][4]=a[3][5]=3.0; a[1][5]=a[2][2]=7.0; a[2][1]=14.0; a[2][5]=8.0;</SPAN>
    <SPAN LANG="en-US">a[2][4]=a[8][3]=0.0; a[3][1]=a[3][3]=a[6][5] = -1.0; a[3][2]=13.0;</SPAN>
    <SPAN LANG="en-US">a[3][4] = -11.0; a[4][1] = -3.0;</SPAN>
    <SPAN LANG="en-US">a[4][2]=a[4][4]=a[5][4]=a[8][4] = -2.0;</SPAN>
    <SPAN LANG="en-US">a[4][3]=13.0; a[4][5]=a[5][5]=a[8][1]=4.0; a[5][1]=a[6][1]=9.0;</SPAN>
    <SPAN LANG="en-US">a[5][2]=8.0; a[5][3]=a[6][2]=a[7][5]=1.0; a[6][3] = -7.0;</SPAN>
    <SPAN LANG="en-US">a[6][4]=a[7][4]=a[8][2]=5.0; a[7][2] = -6.0; a[7][3]=6.0;</SPAN>
    <SPAN LANG="en-US">b[1] = -1.0; b[2]=2.0; b[3]=1.0; b[4]=4.0; b[5]=0.0;</SPAN>
    <SPAN LANG="en-US">em[0]=1.0e-14; em[2]=1.0e-12; em[4]=80.0; em[6]=1.0e-10;</SPAN>
    <SPAN LANG="en-US">i=Linear_algebra.solund(a,8,5,b,em);</SPAN>
    <SPAN LANG="en-US">DecimalFormat fiveDigit = new DecimalFormat(&quot;0.00000E0&quot;);</SPAN>
    <SPAN LANG="en-US">System.out.println(&quot;Number of singular values not found : &quot; + i +</SPAN>
      <SPAN LANG="en-US">&quot;\nNorm :  &quot; + fiveDigit.format(em[1]) +</SPAN>
      <SPAN LANG="en-US">&quot;\nMaximal neglected subdiagonal element :  &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(em[3]) +</SPAN>
      <SPAN LANG="en-US">&quot;\nNumber of iterations :  &quot; + (int)em[5] +</SPAN>
      <SPAN LANG="en-US">&quot;\nRank :  &quot; + (int)em[7] +</SPAN>
      <SPAN LANG="en-US">&quot;\n\nSolution vector\n   &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[1]) + &quot;\n   &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[2]) + &quot;\n  &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[3]) + &quot;\n   &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[4]) + &quot;\n  &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[5]) + &quot;\n   &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[6]) + &quot;\n   &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[7]) + &quot;\n  &quot; +</SPAN>
      <SPAN LANG="en-US">fiveDigit.format(b[8]));</SPAN>
<SPAN LANG="en-US">	}</SPAN>
<SPAN LANG="en-US">}</SPAN></PRE>
</BODY>
</HTML>